/**
 * 引入头部、尾部、返回顶部按钮
 */
$("#header").load("header.html");
$("#footer").load("footer.html");
$("#rTop").load("rTop.html");

let goods = localStorage.getItem("goods");
let productinfo = $(".productinfo_main");

class Detail{
    constructor(){}
    init(goods, productinfo){
        this.goods = JSON.parse(goods);
        this.productinfo = productinfo;
        console.log(this.goods);
        this.render();
    }
    render(){
        let list = this.goods;
        let html = "";
        html = '<div class="left">'+
                    '<div class="face_box">'+
                        '<img src="'+list.img+'" alt="'+list.name+'">'+
                    '</div>'+
                '</div>'+
                '<div class="right">'+
                    '<p class="title">'+list.name+'</p>'+
                    '<div class="price">'+
                        '<i>￥</i>'+
                        '<span class="now_price">'+list.price+'</span>'+
                    '</div>'+
                    '<div class="btn" data-id="'+list.id+'">'+
                        '<span class="add">加入购物车</span>'+
                        '<span class="reduce">'+'-'+'</span>'+
                    '</div>'
                '</div>'
        this.productinfo.html(html);
    }
    
}
var detail = new Detail();
detail.init(goods, productinfo);